<template>
  <div class="container" @click="handleGallaryClick">
    <span class="iconfont close">&#xe615;</span>
    <div class="wrapper">
      <swiper :options="swiperOptions">
        <swiper-slide>
          <img class="gallary-img" :src="getImgPath(ratingPics.image_hash)" v-if="ratingPics.image_hash" />
        </swiper-slide>
        <!-- <div class="swiper-pagination" slot="pagination"></div> -->
      </swiper>
    </div>
  </div>
</template>

<script>
import { getImgPath } from '@/assets/js/mixin'
export default {
  name: 'Gallary',
  props: ['ratingPics'],
  data () {
    return {
      swiperOptions: {
        pagination: '.swiper-pagination',
        paginationType: 'fraction',
        observeParents: true,
        observer: true
      }
    }
  },
  mixins: [getImgPath],
  methods: {
    handleGallaryClick () {
      this.$emit('close')
    }
  }
}
</script>

<style lang="stylus" scoped>
  .container >>> .swiper-container
    overflow: inherit
  .container
    display: flex
    flex-direction: column
    justify-content: center
    z-index: 9999
    position: fixed
    left: 0
    right: 0
    top: 0
    bottom: 0
    background: #000
    overflow: hidden
    .close
      width: .6rem
      height: .6rem
      line-height: .65rem
      text-align: center
      color: #eee
      background: #222
      border-radius: 100%
      position: fixed
      top: .3rem
      right: .3rem
    .wrapper
      width: 100%
      height: 0
      padding-bottom: 100%
      .gallary-img
        width: 100%
      .swiper-pagination
        color: #fff
        bottom: -1rem
</style>
